Technical Field
This disclosure relates to computing systems, and, more particularly, to a memory corruption prevention system.
Description of the Related Art
Memory corruption occurs in several ways, including when the contents of a memory location are unintentionally modified due to programming errors. For example, accessing memory past the end of an array of bytes reserved for a particular data structure may result in memory corruption. In addition, memory corruption may occur when contents of a memory location are intentionally modified by a malicious attack. When the corrupted memory contents are used later in the computer program, it may lead either to a program crash or to unexpected program behavior. Some programming languages (for example, C and C++) include features such as explicit memory management and pointer arithmetic. These features allow development of efficient applications and system software. However, when a computer programmer incorrectly or maliciously uses these features, memory corruption may occur.
Different types of computer programming languages have different degrees of vulnerability to memory corruption. Consider “type safe” and “type unsafe” computer languages. A “type safe” computer language does not permit a computer programmer to use a value as a data type to which it does not belong. For example, a type safe language does not allow conversion of an integer variable to a pointer value. The C programming language, on the other hand, is one example of a “type unsafe” language. The C language is considered type unsafe due to use of casting, particularly the casting of pointers to a void data type and vice versa. The C++ programming language is also “type unsafe.”
Similarly, a computer programming language may be characterized as “memory safe” when the language allows programs to release a portion of memory only when it is determined the portion of memory is unused for the remainder of the program evaluation. In contrast, a programming language that is “memory unsafe” may cause security vulnerabilities with random-access memory (RAM) access, such as buffer overflows and dangling pointers. Programming languages such as C and C++ that support arbitrary pointer arithmetic, casting, and deallocation are typically “memory unsafe.” Some high-level programming languages are memory safe due to disallowing pointer arithmetic and casting, and by performing memory management techniques such as tracing garbage collection. However, programming efficiency may be reduced.
Many malicious attacks reduce system security through memory corruption and may exploit memory unsafe and/or type unsafe characteristics of a programming language. For example, a type unsafe language may not prevent programming errors such as allowing user input to be used as a pointer value. A malicious attacker may exploit such programming errors to create memory corruption attacks and access various portions of programs or data. Other examples of programming errors include vulnerabilities regarding buffer overflow, heap corruption (such as heap buffer overflow and double free), integer overflow, and format strings.
Accordingly, memory corruption comes in various forms and has various causes. When such corruption does occur, particularly in the application development process, it is desirable for a programmer to be able determine the memory access instruction that caused the corruption. But it is even more desirable to limit the number of occurrences of memory corruption in the first instance.